//
//  GuideViewController.m
//  KuWoCan
//
//  Created by 周小宏 on 2017/5/4.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "GuideViewController.h"
@interface GuideViewController()<UIScrollViewDelegate>

@property (nonatomic, strong) UIScrollView *scroll;
@end

@implementation GuideViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
    self.automaticallyAdjustsScrollViewInsets = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view
    
    [self.view addSubview:self.scroll];
}

- (UIScrollView *)scroll
{
    if (_scroll == nil) {
        _scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREENW, SCREENH)];
        _scroll.contentSize = CGSizeMake(SCREENW*3, SCREENH);
        _scroll.showsHorizontalScrollIndicator = NO;
        _scroll.showsVerticalScrollIndicator = NO;
        _scroll.pagingEnabled = YES;
        _scroll.delegate = self;
        
        for (int i = 0; i < 3; ++i)
        {
            UIImageView *imageV = [TomamaUI createImageView:CGRectMake(i*SCREENW, 0, SCREENW, SCREENH) backGroundImageV:[NSString stringWithFormat:@"引导页0%d",i+1]];
            [_scroll addSubview:imageV];
            
            if (i == 2) {
                imageV.userInteractionEnabled = YES;
                UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(jumpGuide)];
                [imageV addGestureRecognizer:tap];
            }
        }
    }
    return _scroll;
}

-(void)jumpGuide {
    if (self.jumpGuideHandle) {
        self.jumpGuideHandle();
    }
}


@end
